A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the xerographic reproduction by anyone of the patent document or the patent disclosure in exactly the form it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright right whatsoever.
The present invention relates generally to computing systems in which an operating system is being simulated in another operating system environment. In particular, the invention relates to cleaning up Or otherwise de-allocating simulated operating system resources used by a process ported from a native implementation of the simulated operating system.
Application programs are often written to run on specific systems and in conjunction with a specific operating system that performs supervisory control of system resource allocation (e.g., allocation and usage of such system resources as memory, processing time, disk space, peripheral devices, and the like). Use of these processes over time verifies their credibility and operability. The more useful programs become the objects of xe2x80x9cporting,xe2x80x9d i.e., transference to other operating systems different from that for which they were originally designed. This may require the program to be rewritten for the new operating system, and if the new operating system is substantially different, or the programming language in which the program was originally developed is unavailable for the new operating system, the porting task can become tediousxe2x80x94not to mention time consuming and expensive. Of course, the porting process will depend upon the process itself, the structure of the old and new operating systems, and other matters not necessarily relevant here. However, when a program has been ported from one operating system environment to another, the operating system interface (e.g., system services) expected by the ported program must be available in the new operating system environment. For these reasons, it may be desirable to simulate an operating system in a new operating system environment so that the programs being ported need not be substantially revisedxe2x80x94if at all.
In the past, operating systems have been simulated to run in another, new operating system environment by re-writing the new operating system to include the necessary operating system interface and services of the simulated operating system, in effect merging the two operating systems. With this approach, processes designed for one operating environment can be ported to a new environment with relative ease because the merging, if you will, of the two operating systems essentially provides any ported process relatively direct access to the services of the new (now native) operating system through the simulated operating system. The time and expense of re-writing the new operating system is deemed justified by minimal changes needed to the programs being ported.
However, the new operating system may not be accessible for the necessary rewriting to include the xe2x80x9cportedxe2x80x9d or simulated operating system. In this case, the ported operating system is modified to run as a process on the new operating system environment. But, simulating an operating system in another operating system environment in this way carries with it additional problems. One such problem concerns the necessary cleanup of system resources (e.g., removal of data structures, deallocation of memory, etc.) obtained or otherwise used by a (ported) process while running. For example, normally an operating system controls the xe2x80x9cstackxe2x80x9d (i.e., a data structure typically used to contain status data for running processes), and the cleanup is done by the process that is terminating by calling a re-entrant routine that uses services of the operating system and its access to the stack. Thus, the usual cleanup services needed for the operating system being simulated (hereinafter xe2x80x9cSimulated Operating Systemxe2x80x9d or xe2x80x9cSOSxe2x80x9d) will not be available in the new or xe2x80x9cnativexe2x80x9d operating system (hereinafter, xe2x80x9cNative Operating Systemxe2x80x9d or xe2x80x9cNOSxe2x80x9d) on which the SOS runs. Also, there may be code in the SOS that would be beneficial to use in the NOS environment.
Further, it is important that process cleanup succeed regardless of how the process terminates.
It can be seen there is needed a technique for cleanup of a terminated process that has been ported from the operating system for which it was designed to run in another operating system.
The present invention is directed to a computing system in which one operating system is simulated by running it as a process on another operating system, as opposed to simulating the operating system by re-writing the native operating system code. In particular, without any changes to the native operating system to support the simulated operating system. Programs being ported from the environment of the operating system being simulated will require little for no modification. The invention provides a method of cleaning up and/or de-allocating the resources created by the simulated operating system for the process created from the ported programs. According to the present invention, when a ported process is created to run on the Native Operating System, in conjunction with the Simulated Operating System (SOS), a facility of the SOS, a Service Process, will be set to monitor for termination of the ported processxe2x80x94or processes, if more than one is invoked at the same period of time. When the ported process terminates, that termination will bring into creation a subsystem cleanup process which is also monitored by the Service Process. The subsystem cleanup process operates to impersonate the terminated process in order to call a cleanup procedure that forms a part of the Simulated Operating System. When the cleanup process returns, the subsystem process terminates itself and that termination is detected by the Service Process to create two additional cleanup processes: one to finish cleanup of aspects of the terminated process, and the other to cleanup resources obtained or used by the subsystem cleanup process.
An advantage of the present invention is that although there may be substantial modifications made to the SOS in order to port it to the NOS environment, such revisions are needed only once. This obviates having to make substantial revisions to each program being ported to run in the NOS environment.